[iOS][swiftpm] stop baking an absolute HERMES_CLI_PATH into the app pbxproj - #58292
Open
chrfalch wants to merge 1 commit into
Open
[iOS][swiftpm] stop baking an absolute HERMES_CLI_PATH into the app pbxproj#58292chrfalch wants to merge 1 commit into
chrfalch wants to merge 1 commit into
Conversation
chrfalch
force-pushed
the
chrfalch/spm-drop-absolute-hermes-cli-path
branch
from
September 3, 2026 07:29
7164f61 to
6793d6f
Compare
chrfalch
force-pushed
the
chrfalch/spm-drop-absolute-hermes-cli-path
branch
3 times, most recently
from
September 3, 2026 08:17
c1077b1 to
cc6d8dd
Compare
`spm add` wrote the machine-specific absolute path of hermesc from the hermes-compiler npm package into every build configuration, and apps commit that pbxproj. react-native-xcode.sh already resolves hermesc at build time through react-native's own dependency graph, so drop the write: resolveHermesCliPathSetting() and the hermesCliPath parameter it fed go with it. Everything involved arrived with SwiftPM in #57332 and is still Preview-labelled, so removing the parameter from injectSpmIntoPbxproj and mergeReactBuildSettings is in scope even though it shipped in 0.87.0/0.87.1. Nothing a CocoaPods build uses is touched: the pod-derived HERMES_CLI_PATH default, the "hermesc could not be found" error and the hermesc -emit-binary call all pre-date SwiftPM. react-native-xcode.sh is unchanged here. Existing injected projects clean up on the next `spm add`/`update`, which strips every recorded scalar before re-injecting. Known gap, deliberately left for a follow-up: the shell fallback is gated on PODS_ROOT being absent, so a SwiftPM app that keeps side-by-side non-RN pods never reaches it and needs an explicit HERMES_CLI_PATH — set in an xcconfig, not the pbxproj, because the recorded-scalar cleanup is value-blind. Keying that gate on the hermes-engine pod directory would close it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
chrfalch
force-pushed
the
chrfalch/spm-drop-absolute-hermes-cli-path
branch
from
September 3, 2026 08:59
cc6d8dd to
6439916
Compare
cipolleschi
approved these changes
Sep 3, 2026
cipolleschi
left a comment
Contributor
There was a problem hiding this comment.
Thanks for fixing this.
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D118624244. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
npx react-native spm addwritesHERMES_CLI_PATHinto the app's committedproject.pbxproj— the absolute path ofhermescin thehermes-compilernpm package, as resolved on whichever machine ran the command. So every SwiftPM-converted app commits one developer's disk layout.Nothing needs it:
react-native-xcode.shalready resolveshermescat build time through react-native's own dependency graph when the current value is not a file. A relative setting can't replace it either —$(REACT_NATIVE_PATH)/../hermes-compilerbreaks on a symlinkedreact-native, and$(SRCROOT)/../node_modules/…breaks on hoisted monorepos.So this deletes
resolveHermesCliPathSetting(), along with thehermesCliPathparameter it fed oninjectSpmIntoPbxprojandmergeReactBuildSettings. Already-injected projects self-clean on the nextspm add/update, which strips every scalar recorded in.spm-injected.jsonbefore re-injecting.Scope: SwiftPM only
Both pieces involved arrived with SwiftPM in #57332 and first shipped in 0.87.0 —
scripts/spm/generate-spm-xcodeproj.js(the whole file, including the write) and theNODE_HERMESCbuild-time fallback inreact-native-xcode.sh.Everything CocoaPods relies on is older and untouched, all present in 0.86.0: the pod-derived
HERMES_CLI_PATHdefault, the "hermesc could not be found" error, and thehermesc -emit-binarycall. A CocoaPods build cannot be affected by this change.That parameter shipped in 0.87.0 and 0.87.1, but SwiftPM is Preview-labelled, so removing it is in scope. Nothing in the repo passed it except the deleted resolver.
Known limitation
The fallback is gated on
PODS_ROOTbeing absent, so a SwiftPM app that keeps side-by-side non-RN pods skips it and needs an explicitHERMES_CLI_PATH. Evaluating that gate verbatim out of the unchanged script:Pods/(normal SwiftPM app)node_modulesPods/, non-RN pods onlyPods/withhermes-engineSet it in an xcconfig, not the pbxproj:
createdScalarscleanup removes by key, so it would drop a hand-edited value too. Keying the gate on thehermes-enginedirectory would close this — left as a follow-up so this PR doesn't touch the bundling script.Changelog:
[IOS] [FIXED] - SwiftPM: stop baking an absolute, machine-specific HERMES_CLI_PATH into the app's pbxproj; resolve hermesc at build time instead
Test Plan:
Red first — with the source reverted, the new entry-point test fails on a seeded
hermes-compilerfixture:✕ writes no HERMES_CLI_PATH, in any configuration or the marker(1 failed, 76 passed).yarn flow-check(0 errors), plusyarn eslint --max-warnings 0andyarn prettier --checkon the four changed files.End to end: a 0.87.1 SwiftPM app (
@shopify/react-native-skiaexample, no Pods) with theHERMES_CLI_PATHlines removed from its pbxproj builds in Release, the fallback resolvinghermescfromnode_modules/hermes-compiler. That build ran against an earlier revision of this branch which also widened the shell gate; with noPods/it is row 1, where both conditions behave identically. There is no shell test harness, and the script is unchanged here.🤖 Generated with Claude Code